﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Coding4Fun.Toolkit.Controls">

	<Style TargetType="local:RoundButton">
		<Setter Property="BorderBrush" Value="{StaticResource DefaultForegroundBrush}"/>
		<Setter Property="Foreground" Value="{StaticResource DefaultForegroundBrush}"/>
		<Setter Property="FontFamily" Value="{StaticResource FontFamilySegoeSemiBold}"/>
		<Setter Property="PressedBrush" Value="{StaticResource DefaultAccentBrush}" />
		<Setter Property="FontSize" Value="{StaticResource DefaultFontSizeExtraSmall}" />
		<Setter Property="ButtonWidth" Value="{StaticResource DefaultAppButtonSize}"/>
		<Setter Property="ButtonHeight" Value="{StaticResource DefaultAppButtonSize}" />

		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="local:RoundButton">
					<Grid>
						<VisualStateManager.VisualStateGroups>
							<VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal" />
								<VisualState x:Name="MouseOver"/>
								<VisualState x:Name="Pressed">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ButtonBackground">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{Binding PressedBrush, RelativeSource={RelativeSource TemplatedParent}}" />
										</ObjectAnimationUsingKeyFrames>
										
									</Storyboard>
								</VisualState>
								<VisualState x:Name="Disabled">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="ButtonRing">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}" />
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ButtonBackground">
											<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
										</ObjectAnimationUsingKeyFrames>

										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentBody">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}" />
										</ObjectAnimationUsingKeyFrames>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentTitle">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource DefaultDisabledBrush}" />
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
							</VisualStateGroup>
						</VisualStateManager.VisualStateGroups>

						<Border 
							Name="EnabledBackground" 
							Padding="{TemplateBinding Padding}" 
							BorderThickness="0" 
							BorderBrush="Transparent" 
							Background="Transparent">
							<StackPanel Orientation="{TemplateBinding Orientation}">
								<Grid 
									Width="{TemplateBinding ButtonWidth}" 
									Height="{TemplateBinding ButtonHeight}" 
									Margin="0,-10, 0, 0">
									
									<Ellipse
										x:Name="ButtonBackground"
										Stroke="Transparent" 
										Fill="{TemplateBinding Background}" 
										Margin="10" />

									<Grid Name="ContentHost">
										<ContentControl
											Name="ContentBody"
											Content="{TemplateBinding Content}" 
											Foreground="{TemplateBinding Foreground}" 
											HorizontalContentAlignment="Center" 
											VerticalContentAlignment="Center"
											/>
									</Grid>

									<Ellipse
										x:Name="ButtonRing"
										Stroke="{TemplateBinding BorderBrush}" 
										StrokeThickness="3" 
										Fill="Transparent" 
										Margin="10" />
								</Grid>
								
								<ContentControl 
									x:Name="ContentTitle" 
									Content="{TemplateBinding Label}" 
									Foreground="{TemplateBinding Foreground}" 
									HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
									VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
									Style="{StaticResource AppBarText}"/>
								
							</StackPanel>
						</Border>
					</Grid>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>